from django.db import models

# Create your models here.
class ClassModel(models.Model):
    name=models.CharField(max_length=20)
    num=models.IntegerField()
    def __str__(self):
        return self.name
    class Meta():
        db_table='clas'


class StudentsModel(models.Model):
    GENDER_CHOICE={
        (1,'男'),
        (2, '女'),
        (3, '保密'),
    }
    name=models.CharField(max_length=20)
    age=models.IntegerField()
    gender=models.IntegerField(choices=GENDER_CHOICE)
    clas_id=models.ForeignKey(ClassModel,on_delete=models.SET_NULL,null=True,related_name='xxxxx')
    def __str__(self):
        return self.name
    class Meta():
        db_table='students'